{% extends "default/base.html" %}
{% load i18n %}

{% block content %}
<ul class="breadcrumb">
 <li><a href="{% url market_home %}">{% trans "Home" %}</a><span class="divider"> / </span></li>
 <li><a href="{% url market_buy %}">{% trans "Buy" %}</a> <span class="divider"> / </span></li>
 <li class="active">{% trans "Top Sellers" %}</li>
</ul>


<div class="sidebar">
 <div class="well" id="TopSellerSideBar">
{% if best_sellers.count %}
<h5>{% trans "Previous Top Sellers" %}</h5>
{% for best_seller in best_sellers %}
{% if forloop.first %}
{% else %}
	{% if best_seller.shop.owner.get_profile.photo %}
	<img class="item" alt="{{ best_seller.shop.name }}" src="{{ best_seller.shop.owner.get_profile.photo.url_128x135 }}" width="75px"/>
	{% else %}
	<img class="item" alt="{{ best_seller.shop.name }}" src="{{ STATIC_URL }}img/no-photo-big.jpg" width="75px"/>
	{% endif %}
	<div class="date">{% trans "Week" %} {{ best_seller.from_date|date:"d M Y" }}</div>
	<div class="dealer">{{ best_seller.shop.name_shop }}</div>
{% endif %}
{% endfor %}
</div>
</div>



<div class="row">
<h2>{% trans "Top Seller of the Week" %}</h2>

<table class="span12">
<thead>
<tr>
<th>Week</th>
<th>Store</th>
<th>Store Description</th>
<th>Sample Inventory</th>
</tr>
<tbody>


{% if best_sellers %}
{% with best_sellers.0 as best_seller %}
<tr>
<td>{% trans "Week" %} {{ best_seller.from_date|date:"d M Y" }}</td>
<td><a href="http://{{ best_seller.shop.default_dns }}" target="_blank">
	{% if best_seller.shop.owner.get_profile.photo %}
	<img class="item" alt="{{ best_seller.shop.name }}" src="{{ best_seller.shop.owner.get_profile.photo.url_128x135 }}" />
	{% else %}
	{% endif %}
			{{ best_seller.shop.name_shop }}{{ best_seller.shop.admin.get_full_name }}
			<a href="http://{{ best_seller.shop.default_dns }}" target="_blank">{{ best_seller.shop.default_dns }}</a>
   </td>
<td><b>{% trans "About Us" %}</b>
		{% if best_seller.shop.about %}
		{{ best_seller.shop.about.body|safe }}
		{% else %}
		<p>-- {% url "No Description" %} --</p>
		{% endif %}
	</td>
<td>
{% for product in best_seller.shop.last_posted_products %}
<div class="grid_2 top_seller_images">
	<a href="{% url market_buy_product_redirect product.id %}" target="_blank">
	{% if product.child.image %}
	<img class="item" src="{{ product.child.image.image.url_100x100 }}" width="25px" title="{{ product.description|striptags }}"/>
	{% else %}
	<img class="item" src="{{ STATIC_URL }}img/no-photo-medium.jpg" width="25px" title="{{ product.description|striptags }}"/>
	{% endif %}
	<p>{{ product.title|title }}</p>
	</a>
</td>
{% endfor %}
</tr>


{% endwith %}
</tbody>
</table>
</div>
{% else %}

<h3>No best sellers found</h3>
</div>
{% endif %}



{% else %}

<h2>{% trans "No previously best sellers found" %}</h2>
{% endif %}

</div>

{% endblock %}
